package com.base.controller;

import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.base.po.voip.Abouts;
import com.base.service.AboutsService;
import com.base.utils.Produce;

/**
 * 联系我们
 * 
 * @author f 优化日期：10-11
 * 
 */
@Controller
@RequestMapping("/admin")
public class AboutsIndexController {

	@Autowired
	private AboutsService aboutsService; // 联系我们Service

	// 联系我们主页
	@RequestMapping(value = "/abouts_index")
	public ModelAndView index(HttpSession session) {
		Object obj_id = session.getAttribute("adminUserId"); // 登录的用户ID
		if (obj_id == null) {
			return new ModelAndView("jsp/loginCheck"); // 未登录
		}
		Abouts abouts = aboutsService.selectByUserID((String) obj_id); // 商户设置的联系方式
		if (abouts == null) {
			abouts = new Abouts(Produce.getUUID()); // 传入一个新的主键ID
		}
		return new ModelAndView("jsp/abouts_index", "abouts", abouts);
	}
}
